package edu.hunau.cxb18.action;

import edu.hunau.cxb18.pojo.User;
import edu.hunau.cxb18.service.UserService;
import edu.hunau.cxb18.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

/**
 * @author hb
 * @create 2020-02-20 11:49
 */
@WebServlet("/show")
public class UserManagerAction extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        UserServiceImpl userService = new UserServiceImpl();
        List<User> users = userService.showAll();
        PrintWriter out = resp.getWriter();

        out.println("<h1>"+users.toString()+"</h1>");
    }
}
